![]() |
SetResPurge |
||||
Header: | Resources.h | Carbon status: | Supported | |
Tells the Memory Manager to pass the handle of a resource to the Resource Manager before purging the data specified by that handle.
void SetResPurge ( Boolean install );
Specifies whether the Memory Manager checks with the Resource Manager before purging a resource handle.
Specify TRUE to make the Memory Manager pass the handle for a resource to the Resource Manager before purging the resource data to which the handle points. The Resource Manager determines whether the handle points to a resource in the application heap. It also checks if the resource’s resChanged attribute is set to 1. If these two conditions are met, the Resource Manager calls the WriteResource function to write the resource’s resource data to the resource fork before returning control to the Memory Manager.
If you call this function with this parameter set to TRUE and then call the Memory Manager function MoveHHi to move a handle to a resource, the Resource Manager calls the WriteResource function to write the resource data to disk even if the data has not been changed. To prevent this, call SetResPurge with this parameter set to FALSE before you call MoveHHi, then call SetResPurge again with this parameter set to TRUE immediately after you call MoveHHi.
Whenever you call this function with this parameter set to TRUE, the Resource Manager installs its own purge-warning function, overriding any purge-warning function you’ve specified to the Memory Manager.
Specify FALSE to restore the normal state, so that the Memory Manager purges resource data when it needs to without calling the Resource Manager.
You can use this function in applications that modify purgeable resources. You should also take precautions in such applications to ensure that the resource won’t be purged while you’re changing it.
To check for errors, call the ResError function.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)